package com.syni.mdd.sjb.common.datatreaure.controller.protect.dataTreasure.saasminapp;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.controller.BaseController;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.coupon.IdRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.coupon.SaveCouponRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.coupon.TypeRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.coupon.UpdateCouponRqVo;
import com.syni.mdd.sjb.common.datatreaure.service.databank.saasminapp.MinCouponService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/minApp/coupon")
public class MinCouponController extends BaseController {

    @Autowired
    private MinCouponService minCouponService;

    @PostMapping("/stopPublishCoupon")
    @ApiOperation(value = "停止发放优惠券")
    @CheckUserIdentity
    public Map<String,Object> stopPublishCoupon(@RequestBody IdRqVo idRqVo){
        return minCouponService.stopPublishCoupon(idRqVo);
    }

    @PostMapping("/getCouponList")
    @ApiOperation(value = "查询优惠券列表")
    @CheckUserIdentity
    public Map<String,Object> getCouponList(@RequestBody TypeRqVo typeRqVo){
        return minCouponService.getCouponList(typeRqVo);
    }

    @PostMapping("/saveCoupon")
    @ApiOperation(value = "保存优惠卷")
    @CheckUserIdentity
    public Map<String,Object> saveCoupon(@RequestBody SaveCouponRqVo saveCouponRqVo){
        return minCouponService.saveCoupon(saveCouponRqVo);
    }

    @PostMapping("/updateCoupon")
    @ApiOperation(value = "更新优惠卷")
    @CheckUserIdentity
    public Map<String,Object> updateCoupon(@RequestBody UpdateCouponRqVo updateCouponRqVo){
        return minCouponService.updateCoupon(updateCouponRqVo);
    }

    @PostMapping("/getCouponDetail")
    @ApiOperation(value = "查询优惠卷明细")
    @CheckUserIdentity
    public Map<String,Object> getCouponDetail(@RequestBody IdRqVo idRqVo){
        return minCouponService.getCouponDetail(idRqVo);
    }

    @PostMapping("/deleteCoupon")
    @ApiOperation(value = "删除优惠卷")
    @CheckUserIdentity
    public Map<String,Object> deleteCoupon(@RequestBody IdRqVo idRqVo){
        return minCouponService.deleteCoupon(idRqVo);
    }

}
